﻿Imports System.ComponentModel.DataAnnotations

Namespace Ita.ProElicere.Model

    Public Class User

        Public Sub New()

        End Sub

        Public Sub New(id As Integer)
            UserID = id
        End Sub


        <ScaffoldColumn(False)> _
        Public Property UserID() As Integer

        Public Property CompanyID() As System.Nullable(Of Integer)
        Public Overridable Property Company() As Company

        <Required(ErrorMessage:="The name is required"), StringLength(100), Display(Name:="Name")> _
        Public Property Name() As String

        <Required(ErrorMessage:="The login is required"), StringLength(100), Display(Name:="login")> _
        Public Property Login() As String

        <Required(ErrorMessage:="The password is required"), StringLength(100), Display(Name:="Password")> _
        Public Property Password() As String

        <Required(ErrorMessage:="The email is required"), StringLength(100), Display(Name:="Email")> _
        <RegularExpression("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}", ErrorMessage:="Email invalid.")> _
        Public Property Email() As String


        <ScaffoldColumn(False)> _
        Public Property UserRole() As String


        Public Overridable Property ProjectUsers() As ICollection(Of ProjectUser)

    End Class
End Namespace
